package org.jeecg.modules.demo.gmslopedata1.controller;


import org.jeecg.modules.demo.gmslopedata1.entity.GmSlopeData1;
import org.jeecg.modules.demo.rockslopestablesetting.entity.RockSlopeStableSetting;
import org.jeecg.modules.demo.sloperiskevaluationsetting.entity.SlopeRiskEvaluationSetting;
import org.jeecg.modules.demo.slopestablesetting.entity.SlopeStableSetting;
import org.jeecg.modules.demo.soilrockslopesetting.entity.SoilRockSlopeSetting;

/**
 * 功能描述
 *
 * @program: geology-monitor
 * @description:
 * @author: wwq
 * @create: 2025-06-22 11:00
 **/
public class Utils1 {


    /**
     * 计算土质边坡的 Y 值
     *
     * @param setting
     * @param gmSlopeData
     * @return
     */
    public static double calculateSlopeY(SlopeStableSetting setting, GmSlopeData1 gmSlopeData) {
        double y = 0.00;

        // 切坡高度
        y += setting.getCutSlopeHeightWeight() * getCutSlopeHeightValue(setting, gmSlopeData.getCutSlopeHeight());

        // 切坡坡度
        y += setting.getCutSlopeGradientWeight() * getCutSlopeGradientValue(setting, gmSlopeData.getCutSlopeGradient());
        //岩组类型
        y += setting.getRockTypeWeight() * calculateRockY(setting, gmSlopeData.getRockType());

        // 切坡坡形
        y += setting.getCutSlopeShapeWeight() * getCutSlopeShapeValue(setting, gmSlopeData.getCutSlopeShape());

        // 自然斜坡坡度
        y += setting.getNaturalSlopeGradientWeight() * getNaturalSlopeGradientValue(setting, gmSlopeData.getNaturalSlopeGradient());

        // 土层松散程度
        y += setting.getSoilLoosenessWeight() * getSoilLoosenessValue(setting, gmSlopeData.getSoilLooseness());

        // 土体类型
        y += setting.getOverlyingSoilTypeWeight() * getOverlyingSoilTypeValue(setting, gmSlopeData.getOverlyingSoilType());

        // 植被覆盖率
        y += setting.getVegetationCoverageWeight() * getVegetationCoverageValue(setting, gmSlopeData.getVegetationCoverage());

        // 已有治理措施
        y += setting.getGovernanceMeasuresWeight() * getGovernanceMeasuresValue(setting, gmSlopeData.getGovernanceMeasures());

        return y;
    }

    /**
     * 计算岩质边坡的 Y 值
     *
     * @param setting
     * @param gmSlopeData
     * @return
     */
    public static double calculateRockY(RockSlopeStableSetting setting, GmSlopeData1 gmSlopeData) {
        double y = 0.00;
        // 切坡高度
        y += setting.getCutSlopeHeightWeight() * getCutSlopeHeightValue(setting, gmSlopeData.getCutSlopeHeight());
        // 切坡坡度
        y += setting.getCutSlopeGradientWeight() * getCutSlopeGradientValue(setting, gmSlopeData.getCutSlopeGradient());
        //切坡坡形
        y += setting.getCutSlopeShapeWeight() * getCutSlopeShapeValue(setting, gmSlopeData.getCutSlopeShape());
        // 自然斜坡坡度
        y += setting.getNaturalSlopeGradientWeight() * getNaturalSlopeGradientValue(setting, gmSlopeData.getNaturalSlopeGradient());
        //岩体特征
        y += setting.getRockCharacteristicsWeight() * getRockCharacteristicsValue(setting, gmSlopeData.getRockCharacteristics());
        //裂隙发育程度
        y += setting.getFractureDevelopmentWeight() * getFractureDevelopmentValue(setting, gmSlopeData.getFractureDevelopmentDegree());
        //岩组类型
        y += setting.getRockTypeWeight() * calculateRockY(setting, gmSlopeData.getRockType());
        // 植被覆盖率
        y += setting.getVegetationCoverageWeight() * getVegetationCoverageValue(setting, gmSlopeData.getVegetationCoverage());

        // 已有治理措施
        y += setting.getGovernanceMeasuresWeight() * getGovernanceMeasuresValue(setting, gmSlopeData.getGovernanceMeasures());

        return y;

    }
    /**
     * 计算土岩质边坡的 Y 值
     *
     * @param riskSetting
     * @param gmSlopeData
     * @return
     */

    public static double calculateDangerY(SlopeRiskEvaluationSetting riskSetting, GmSlopeData1 gmSlopeData) {
        double y = 0.0;
        // 切坡墙距（A）slopeWallDistanceWeight
        y += riskSetting.getSlopeWallDistanceWeight() * getWallDistanceValue(riskSetting, gmSlopeData.getSlopeWallDistance());
        //		 切坡时间
        y += riskSetting.getCutSlopeTimeWeight() * getCutSlopeTimeValue(riskSetting, gmSlopeData.getCutSlopeTime());
        // 切坡宽度（B）
        y += riskSetting.getCutSlopeWidthWeight() * getCutSlopeWidthValue(riskSetting, gmSlopeData.getCutSlopeWidth());
        // 威胁人口（C） 4
        y += riskSetting.getThreatPopulationWeight() * getThreatPopulationValue(riskSetting, gmSlopeData.getThreatPopulation());
        // 威胁房屋结构 4
        y += riskSetting.getThreatHouseWeight() * getThreatHouseValue(riskSetting, gmSlopeData.getThreatHouse());
        return y;

    }

    private static double getFractureDevelopmentValue(RockSlopeStableSetting setting, String fractureDevelopmentDegree) {
        switch (fractureDevelopmentDegree) {
            case "A":
                return setting.getFractureDevelopment1();
            case "B":
                return setting.getFractureDevelopment2();
            default:
                //获取平均值计算
                double sum = setting.getFractureDevelopment1() + setting.getFractureDevelopment2();
                return sum/2;
        }
    }
    private static double getFractureDevelopmentValue(SoilRockSlopeSetting setting, String fractureDevelopmentDegree) {
        switch (fractureDevelopmentDegree) {
            case "A":
                return setting.getUnderRockFracture1();
            case "B":
                return setting.getUnderRockFracture2();
            default:
                //获取平均值计算
                double sum = setting.getUnderRockFracture1() + setting.getUnderRockFracture2();
                return sum/2;
        }
    }
    /**
     * 计算混合边坡的 Y 值
     *
     * @param setting
     * @param gmSlopeData
     * @return
     */
    static double calculateSoilRockY(SoilRockSlopeSetting setting, GmSlopeData1 gmSlopeData) {
        double y = 0.0;
        // 切坡高度
        y += setting.getCutSlopeHeightWeight() * getCutSlopeHeightValue(setting, gmSlopeData.getCutSlopeHeight());

        // 切坡坡度
        y += setting.getCutSlopeGradientWeight() * getCutSlopeGradientValue(setting, gmSlopeData.getCutSlopeGradient());


        // 切坡坡形
        y += setting.getCutSlopeShapeWeight() * getCutSlopeShapeValue(setting, gmSlopeData.getCutSlopeShape());

        // 自然斜坡坡度
        y += setting.getNaturalSlopeGradientWeight() * getNaturalSlopeGradientValue(setting, gmSlopeData.getNaturalSlopeGradient());
        //上覆土层松散程度upperSoilLoosenessWeight
        y += setting.getUpperSoilLoosenessWeight() * getSoilLoosenessValue(setting, gmSlopeData.getSoilLooseness());
        //上覆土体类型upperSoilTypeWeight
        y += setting.getUpperSoilTypeWeight() * getOverlyingSoilTypeValue(setting, gmSlopeData.getOverlyingSoilType());
//		 下部岩体特征underCharacteristicsWeight
        y += setting.getUnderCharacteristicsWeight() * getRockCharacteristicsValue(setting, gmSlopeData.getRockCharacteristics());
        // 下部岩体裂隙发育程度underRockFractureWeight
        y += setting.getUnderRockFractureWeight() * getFractureDevelopmentValue(setting, gmSlopeData.getFractureDevelopmentDegree());
        //岩组类型
        y += setting.getRockTypeWeight()* calculateRockY(setting, gmSlopeData.getRockType());

        // 植被覆盖率
        y += setting.getVegetationCoverageWeight() * getVegetationCoverageValue(setting, gmSlopeData.getVegetationCoverage());

        // 已有治理措施
        y += setting.getGovernanceMeasuresWeight() * getGovernanceMeasuresValue(setting, gmSlopeData.getGovernanceMeasures());
        return y;
    }

    private static double getRockCharacteristicsValue(RockSlopeStableSetting setting, String rockCharacteristics) {

        switch (rockCharacteristics) {
            case "A":
                return setting.getRockCharacteristics1();
            case "B":
                return setting.getRockCharacteristics2();
            default:
                //获取平均值计算
                double sum = setting.getRockCharacteristics1() + setting.getRockCharacteristics2();
                return sum/2;
        }
    }
    private static double getRockCharacteristicsValue(SoilRockSlopeSetting setting, String rockCharacteristics) {

        switch (rockCharacteristics) {
            case "A":
                return setting.getUnderCharacteristics1();
            case "B":
                return setting.getUnderCharacteristics2();
            default:
                //获取平均值计算
                double sum = setting.getUnderCharacteristics1() + setting.getUnderCharacteristics2();
                return sum/2;
        }
    }

    /**
     * 根据切坡高度获取对应的值
     *
     * @param setting
     * @param cutSlopeHeight
     * @return
     */
    private static double getCutSlopeHeightValue(SlopeStableSetting setting, String cutSlopeHeight) {
        switch (cutSlopeHeight) {
            case "A":
                return setting.getCutSlopeHeight1();
            case "B":
                return setting.getCutSlopeHeight2();
            case "C":
                return setting.getCutSlopeHeight3();
            case "D":
                return setting.getCutSlopeHeight4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeHeight1() + setting.getCutSlopeHeight2() + setting.getCutSlopeHeight3() + setting.getCutSlopeHeight4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据切坡高度获取对应的值
     *
     * @param setting
     * @param cutSlopeHeight
     * @return
     */
    private static double getCutSlopeHeightValue(RockSlopeStableSetting setting, String cutSlopeHeight) {
        switch (cutSlopeHeight) {
            case "A":
                return setting.getCutSlopeHeight1();
            case "B":
                return setting.getCutSlopeHeight2();
            case "C":
                return setting.getCutSlopeHeight3();
            case "D":
                return setting.getCutSlopeHeight4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeHeight1() + setting.getCutSlopeHeight2() + setting.getCutSlopeHeight3() + setting.getCutSlopeHeight4();
                return sum/4; // 默认值或抛出异常
        }
    }

    /**
     * 根据切坡高度获取对应的值
     *
     * @param setting
     * @param cutSlopeHeight
     * @return
     */
    private static double getCutSlopeHeightValue(SoilRockSlopeSetting setting, String cutSlopeHeight) {
        switch (cutSlopeHeight) {
            case "A":
                return setting.getCutSlopeHeight1();
            case "B":
                return setting.getCutSlopeHeight2();
            case "C":
                return setting.getCutSlopeHeight3();
            case "D":
                return setting.getCutSlopeHeight4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeHeight1() + setting.getCutSlopeHeight2() + setting.getCutSlopeHeight3() + setting.getCutSlopeHeight4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据切坡坡度获取对应的值
     *
     * @param setting
     * @param cutSlopeGradient
     * @return
     */
    private static double getCutSlopeGradientValue(SlopeStableSetting setting, String cutSlopeGradient) {
        switch (cutSlopeGradient) {
            case "A°":
                return setting.getCutSlopeGradient1();
            case "B":
                return setting.getCutSlopeGradient2();
            case "C°":
                return setting.getCutSlopeGradient3();
            case "D":
                return setting.getCutSlopeGradient4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeGradient1() + setting.getCutSlopeGradient2() + setting.getCutSlopeGradient3() + setting.getCutSlopeGradient4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据切坡坡度获取对应的值
     *
     * @param setting
     * @param cutSlopeGradient
     * @return
     */
    private static double getCutSlopeGradientValue(RockSlopeStableSetting setting, String cutSlopeGradient) {
        switch (cutSlopeGradient) {
            case "A°":
                return setting.getCutSlopeGradient1();
            case "B":
                return setting.getCutSlopeGradient2();
            case "C°":
                return setting.getCutSlopeGradient3();
            case "D":
                return setting.getCutSlopeGradient4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeGradient1() + setting.getCutSlopeGradient2() + setting.getCutSlopeGradient3() + setting.getCutSlopeGradient4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据切坡坡度获取对应的值
     *
     * @param setting
     * @param cutSlopeGradient
     * @return
     */
    private static double getCutSlopeGradientValue(SoilRockSlopeSetting setting, String cutSlopeGradient) {
        switch (cutSlopeGradient) {
            case "A°":
                return setting.getCutSlopeGradient1();
            case "B":
                return setting.getCutSlopeGradient2();
            case "C°":
                return setting.getCutSlopeGradient3();
            case "D":
                return setting.getCutSlopeGradient4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeGradient1() + setting.getCutSlopeGradient2() + setting.getCutSlopeGradient3() + setting.getCutSlopeGradient4();
                return sum/4; // 默认值或抛出异常
        }
    }

    /**
     * 计算岩组类型的 Y 值
     *
     * @param setting
     * @param rockType
     * @return
     */
    private static double calculateRockY(SlopeStableSetting setting, String rockType) {
        switch (rockType) {
            case "Y1":
                return setting.getRockType1();
            case "Y2":
                return setting.getRockType2();
            case "B3":
                return setting.getRockType3();
            case "B2":
                return setting.getRockType4();
            case "B1":
                return setting.getRockType5();
            case "S3":
                return setting.getRockType6();
            case "S4":
                return setting.getRockType7();
            case "S1":
                return setting.getRockType8();
            case "S2":
                return setting.getRockType9();
            case "S5":
                return setting.getRockType10();
            case "T3":
                return setting.getRockType11();
            case "T2":
                return setting.getRockType12();
            case "T1":
                return setting.getRockType13();
            default:
                //获取平均值计算
                double sum = setting.getRockType1() + setting.getRockType2() +
                        setting.getRockType3() + setting.getRockType4() +
                        setting.getRockType5() + setting.getRockType6() +
                        setting.getRockType7() + setting.getRockType8() +
                        setting.getRockType9() + setting.getRockType10() +
                        setting.getRockType11() + setting.getRockType12() +
                        setting.getRockType13();
                return sum/13; // 默认值或抛出异常
        }
    }
    /**
     * 计算岩组类型的 Y 值
     *
     * @param setting
     * @param rockType
     * @return
     */
    private static double calculateRockY(SoilRockSlopeSetting setting, String rockType) {
        switch (rockType) {
            case "Y1":
                return setting.getRockType1();
            case "Y2":
                return setting.getRockType2();
            case "B3":
                return setting.getRockType3();
            case "B2":
                return setting.getRockType4();
            case "B1":
                return setting.getRockType5();
            case "C":
                return setting.getRockType6();
            case "D":
                return setting.getRockType7();
            case "A":
                return setting.getRockType8();
            case "B":
                return setting.getRockType9();
            case "S5":
                return setting.getRockType10();
            case "T3":
                return setting.getRockType11();
            case "T2":
                return setting.getRockType12();
            case "T1":
                return setting.getRockType13();
            default:
                //获取平均值计算
                double sum = setting.getRockType1() + setting.getRockType2() +
                        setting.getRockType3() + setting.getRockType4() +
                        setting.getRockType5() + setting.getRockType6() +
                        setting.getRockType7() + setting.getRockType8() +
                        setting.getRockType9() + setting.getRockType10() +
                        setting.getRockType11() + setting.getRockType12() +
                        setting.getRockType13();
                return sum/13; // 默认值或抛出异常
        }
    }
    /**
     * 计算岩组类型的 Y 值
     *
     * @param setting
     * @param rockType
     * @return
     */
    private static double calculateRockY(RockSlopeStableSetting setting, String rockType) {
        switch (rockType) {
            case "Y1":
                return setting.getRockType1();
            case "Y2":
                return setting.getRockType2();
            case "B3":
                return setting.getRockType3();
            case "B2":
                return setting.getRockType4();
            case "B1":
                return setting.getRockType5();
            case "C":
                return setting.getRockType6();
            case "D":
                return setting.getRockType7();
            case "A":
                return setting.getRockType8();
            case "B":
                return setting.getRockType9();
            case "S5":
                return setting.getRockType10();
            case "T3":
                return setting.getRockType11();
            case "T2":
                return setting.getRockType12();
            case "T1":
                return setting.getRockType13();
            default:
                //获取平均值计算
                double sum = setting.getRockType1() + setting.getRockType2() +
                        setting.getRockType3() + setting.getRockType4() +
                        setting.getRockType5() + setting.getRockType6() +
                        setting.getRockType7() + setting.getRockType8() +
                        setting.getRockType9() + setting.getRockType10() +
                        setting.getRockType11() + setting.getRockType12() +
                        setting.getRockType13();
                return sum/13; // 默认值或抛出异常
        }
    }

    /**
     * 根据切坡坡形获取对应的值
     *
     * @param setting
     * @param cutSlopeShape
     * @return
     */
    private static double getCutSlopeShapeValue(SlopeStableSetting setting, String cutSlopeShape) {
        switch (cutSlopeShape) {
            case "A":
                return setting.getCutSlopeShape1();
            case "B":
                return setting.getCutSlopeShape2();
            case "C":
                return setting.getCutSlopeShape3();
            case "D":
                return setting.getCutSlopeShape4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeShape1() + setting.getCutSlopeShape2() + setting.getCutSlopeShape3() + setting.getCutSlopeShape4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据切坡坡形获取对应的值
     *
     * @param setting
     * @param cutSlopeShape
     * @return
     */
    private static double getCutSlopeShapeValue(SoilRockSlopeSetting setting, String cutSlopeShape) {
        switch (cutSlopeShape) {
            case "A":
                return setting.getCutSlopeShape1();
            case "B":
                return setting.getCutSlopeShape2();
            case "C":
                return setting.getCutSlopeShape3();
            case "D":
                return setting.getCutSlopeShape4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeShape1() + setting.getCutSlopeShape2() + setting.getCutSlopeShape3() + setting.getCutSlopeShape4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据切坡坡形获取对应的值
     *
     * @param setting
     * @param cutSlopeShape
     * @return
     */
    private static double getCutSlopeShapeValue(RockSlopeStableSetting setting, String cutSlopeShape) {
        switch (cutSlopeShape) {
            case "A":
                return setting.getCutSlopeShape1();
            case "B":
                return setting.getCutSlopeShape2();
            case "C":
                return setting.getCutSlopeShape3();
            case "D":
                return setting.getCutSlopeShape4();
            default:
                //获取平均值计算
                double sum = setting.getCutSlopeShape1() + setting.getCutSlopeShape2() + setting.getCutSlopeShape3() + setting.getCutSlopeShape4();
                return sum/4; // 默认值或抛出异常
        }
    }

    /**
     * 根据自然斜坡坡度获取对应的值
     *
     * @param setting
     * @param naturalSlopeGradient
     * @return
     */
    private static double getNaturalSlopeGradientValue(SlopeStableSetting setting, String naturalSlopeGradient) {
        switch (naturalSlopeGradient) {
            case "A":
                return setting.getNaturalSlopeGradient1();
            case "B":
                return setting.getNaturalSlopeGradient2();
            case "C":
                return setting.getNaturalSlopeGradient3();
            default:
                //获取平均值计算
                double sum = setting.getNaturalSlopeGradient1() + setting.getNaturalSlopeGradient2() + setting.getNaturalSlopeGradient3();
                return sum/3; // 默认值或抛出异常
        }
    }
    /**
     * 根据自然斜坡坡度获取对应的值
     *
     * @param setting
     * @param naturalSlopeGradient
     * @return
     */
    private static double getNaturalSlopeGradientValue(SoilRockSlopeSetting setting, String naturalSlopeGradient) {
        switch (naturalSlopeGradient) {
            case "A":
                return setting.getNaturalSlopeGradient1();
            case "B":
                return setting.getNaturalSlopeGradient2();
            case "C":
                return setting.getNaturalSlopeGradient3();
            default:
                //获取平均值计算
                double sum = setting.getNaturalSlopeGradient1() + setting.getNaturalSlopeGradient2() + setting.getNaturalSlopeGradient3();
                return sum/3; // 默认值或抛出异常
        }
    }
    /**
     * 根据自然斜坡坡度获取对应的值
     *
     * @param setting
     * @param naturalSlopeGradient
     * @return
     */
    private static double getNaturalSlopeGradientValue(RockSlopeStableSetting setting, String naturalSlopeGradient) {
        switch (naturalSlopeGradient) {
            case "A":
                return setting.getNaturalSlopeGradient1();
            case "B":
                return setting.getNaturalSlopeGradient2();
            case "C":
                return setting.getNaturalSlopeGradient3();
            default:
                //获取平均值计算
                double sum = setting.getNaturalSlopeGradient1() + setting.getNaturalSlopeGradient2() + setting.getNaturalSlopeGradient3();
                return sum/3; // 默认值或抛出异常
        }
    }

    /**
     * 根据土层松散程度获取对应的值
     *
     * @param setting
     * @param soilLooseness
     * @return
     */
    private static double getSoilLoosenessValue(SlopeStableSetting setting, String soilLooseness) {
        switch (soilLooseness) {
            case "A":
                return setting.getSoilLooseness1();
            case "B":
                return setting.getSoilLooseness2();
            default:
                //获取平均值计算
                double sum = setting.getSoilLooseness1() + setting.getSoilLooseness2();
                return sum/2; // 默认值或抛出异常
        }
    }
    /**
     * 根据土层松散程度获取对应的值
     *
     * @param setting
     * @param soilLooseness
     * @return
     */
    private static double getSoilLoosenessValue(SoilRockSlopeSetting setting, String soilLooseness) {
        switch (soilLooseness) {
            case "A":
                return setting.getUpperSoilLooseness1();
            case "B":
                return setting.getUpperSoilLooseness2();
            default:
                //获取平均值计算
                double sum = setting.getUpperSoilLooseness1() + setting.getUpperSoilLooseness2();
                return sum/2; // 默认值或抛出异常
        }
    }

    /**
     * 根据土体类型获取对应的值
     *
     * @param setting
     * @param overlyingSoilType
     * @return
     */
    private static double getOverlyingSoilTypeValue(SlopeStableSetting setting, String overlyingSoilType) {
        switch (overlyingSoilType) {
            case "A":
                return setting.getOverlyingSoilType1();
            case "B":
                return setting.getOverlyingSoilType2();
            case "C":
                return setting.getOverlyingSoilType3();
            default:
                //获取平均值计算
                double sum = setting.getOverlyingSoilType1() + setting.getOverlyingSoilType2() + setting.getOverlyingSoilType3();
                return sum/3; // 默认值或抛出异常
        }
    }
    /**
     * 根据土体类型获取对应的值
     *
     * @param setting
     * @param overlyingSoilType
     * @return
     */
    private static double getOverlyingSoilTypeValue(SoilRockSlopeSetting setting, String overlyingSoilType) {
        switch (overlyingSoilType) {
            case "A":
                return setting.getUpperSoilType1();
            case "B":
                return setting.getUpperSoilType2();
            case "C":
                return setting.getUpperSoilType3();
            default:
                //获取平均值计算
                double sum = setting.getUpperSoilType1() + setting.getUpperSoilType2() + setting.getUpperSoilType3();
                return sum/3; // 默认值或抛出异常
        }
    }

    /**
     * 根据植被覆盖率获取对应的值
     *
     * @param setting
     * @param vegetationCoverage
     * @return
     */
    private static double getVegetationCoverageValue(SlopeStableSetting setting, String vegetationCoverage) {
        switch (vegetationCoverage) {
            case "A":
                return setting.getVegetationCoverage1();
            case "B":
                return setting.getVegetationCoverage2();
            case "C":
                return setting.getVegetationCoverage3();
            default:
                //获取平均值计算
                double sum = setting.getVegetationCoverage1() + setting.getVegetationCoverage2() + setting.getVegetationCoverage3();
                return sum/3; // 默认值或抛出异常
        }
    }
    /**
     * 根据植被覆盖率获取对应的值
     *
     * @param setting
     * @param vegetationCoverage
     * @return
     */
    private static double getVegetationCoverageValue(SoilRockSlopeSetting setting, String vegetationCoverage) {
        switch (vegetationCoverage) {
            case "A":
                return setting.getVegetationCoverage1();
            case "B":
                return setting.getVegetationCoverage2();
            case "C":
                return setting.getVegetationCoverage3();
            default:
                //获取平均值计算
                double sum = setting.getVegetationCoverage1() + setting.getVegetationCoverage2() + setting.getVegetationCoverage3();
                return sum/3; // 默认值或抛出异常
        }
    }
    /**
     * 根据植被覆盖率获取对应的值
     *
     * @param setting
     * @param vegetationCoverage
     * @return
     */
    private static double getVegetationCoverageValue(RockSlopeStableSetting setting, String vegetationCoverage) {
        switch (vegetationCoverage) {
            case "A":
                return setting.getVegetationCoverage1();
            case "B":
                return setting.getVegetationCoverage2();
            case "C":
                return setting.getVegetationCoverage3();
            default:
                //获取平均值计算
                double sum = setting.getVegetationCoverage1() + setting.getVegetationCoverage2() + setting.getVegetationCoverage3();
                return sum/3; // 默认值或抛出异常
        }
    }

    /**
     * 根据已有治理措施获取对应的值
     *
     * @param setting
     * @param governanceMeasures
     * @return
     */
    private static double getGovernanceMeasuresValue(SlopeStableSetting setting, String governanceMeasures) {
        switch (governanceMeasures) {
            case "A":
                return setting.getGovernanceMeasures1();
            case "B":
                return setting.getGovernanceMeasures2();
            case "C":
                return setting.getGovernanceMeasures3();
            case "D":
                return setting.getGovernanceMeasures4();
            default:
                //获取平均值计算
                double sum = setting.getGovernanceMeasures1() + setting.getGovernanceMeasures2() + setting.getGovernanceMeasures3() + setting.getGovernanceMeasures4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据已有治理措施获取对应的值
     *
     * @param setting
     * @param governanceMeasures
     * @return
     */
    private static double getGovernanceMeasuresValue(SoilRockSlopeSetting setting, String governanceMeasures) {
        switch (governanceMeasures) {
            case "A":
                return setting.getGovernanceMeasures1();
            case "B":
                return setting.getGovernanceMeasures2();
            case "C":
                return setting.getGovernanceMeasures3();
            case "D":
                return setting.getGovernanceMeasures4();
            default:
                //获取平均值计算
                double sum = setting.getGovernanceMeasures1() + setting.getGovernanceMeasures2() + setting.getGovernanceMeasures3() + setting.getGovernanceMeasures4();
                return sum/4; // 默认值或抛出异常
        }
    }
    /**
     * 根据已有治理措施获取对应的值
     *
     * @param setting
     * @param governanceMeasures
     * @return
     */
    private static double getGovernanceMeasuresValue(RockSlopeStableSetting setting, String governanceMeasures) {
        switch (governanceMeasures) {
            case "A":
                return setting.getGovernanceMeasures1();
            case "B":
                return setting.getGovernanceMeasures2();
            case "C":
                return setting.getGovernanceMeasures3();
            case "D":
                return setting.getGovernanceMeasures4();
            default:
                //获取平均值计算
                double sum = setting.getGovernanceMeasures1() + setting.getGovernanceMeasures2() + setting.getGovernanceMeasures3() + setting.getGovernanceMeasures4();
                return sum/4; // 默认值或抛出异常
        }
    }


    private static double getThreatHouseValue(SlopeRiskEvaluationSetting riskSetting, String threatHouse) {
        switch (threatHouse) {
            case "A":
                return riskSetting.getThreatHouse1();
            case "B":
                return riskSetting.getThreatHouse2();
            case "C":
                return riskSetting.getThreatHouse3();
            case "D":
                return riskSetting.getThreatHouse4();
            default:
                //获取平均值计算
                double sum = riskSetting.getThreatHouse1() + riskSetting.getThreatHouse2()+
                        riskSetting.getThreatHouse3() + riskSetting.getThreatHouse4();
                return sum/4;
        }
    }

    private static double getThreatPopulationValue(SlopeRiskEvaluationSetting riskSetting, String threatPopulation) {
//        威胁人口（C）	0.2	B＜3    A
//        3≤B＜10                   B

//        10≤B＜30                   C
//        30≤B                       D
        //根据人数进行判断
        int B = Integer.parseInt(threatPopulation);
        if (B < 3) {
            return riskSetting.getThreatPopulation1();
        } else if (B < 10) {
            return riskSetting.getThreatPopulation2();
        } else if (B < 30) {
            return riskSetting.getThreatPopulation3();
        } else if (B >= 30) {
            return riskSetting.getThreatPopulation4();
        }else {
                //获取平均值计算
                double sum = riskSetting.getThreatPopulation1() + riskSetting.getThreatPopulation2() +
                        riskSetting.getThreatPopulation3() + riskSetting.getThreatPopulation4();
                return sum / 2;
        }
    }




    private static double getCutSlopeWidthValue(SlopeRiskEvaluationSetting riskSetting, String cutSlopeWidth) {
        switch (cutSlopeWidth) {
            case "A":
                return riskSetting.getCutSlopeWidth1();
            case "B":
                return riskSetting.getCutSlopeWidth2();
            case "C":
                return riskSetting.getCutSlopeWidth3();
            case "D":
                return riskSetting.getCutSlopeWidth4();
            default:
                //获取平均值计算
                double sum = riskSetting.getCutSlopeWidth1() + riskSetting.getCutSlopeWidth2();
                return sum/2;
        }
    }

    private static double getCutSlopeTimeValue(SlopeRiskEvaluationSetting riskSetting, String cutSlopeTime) {
        switch (cutSlopeTime) {
            case "A":
                return riskSetting.getCutSlopeTime1();
            case "B":
                return riskSetting.getCutSlopeTime2();
            default:
                //获取平均值计算
                double sum = riskSetting.getCutSlopeTime1() + riskSetting.getCutSlopeTime2();
                return sum/2;
        }
    }

    private static double getWallDistanceValue(SlopeRiskEvaluationSetting riskSetting, String slopeWallDistance) {
        switch (slopeWallDistance) {
            case "A":
                return riskSetting.getSlopeWallDistance1();
            case "B":
                return riskSetting.getSlopeWallDistance2();
            case "C":
                return riskSetting.getSlopeWallDistance3();
            case "D":
                return riskSetting.getSlopeWallDistance4();
            default:
                //获取平均值计算
                double sum = riskSetting.getSlopeWallDistance1() + riskSetting.getSlopeWallDistance2();
                return sum/2;
        }
    }
}
